package day0328;

import java.util.ArrayList;
//数组求长度：数据名.length;       String数据求长度   字符串.length();      集合求元素个数   集合名.size();
public class Test6 {
    public static void main(String[] args) {
        //1.创建一个cards1集合
        ArrayList cards1 = new ArrayList();
        cards1.add(1);//2.给里边存入三个元素//底层用数组存元素
        cards1.add(2);
        cards1.add("你");
        System.out.println(cards1.get(0));//3.取出第0个元素 //[1,2,"你"]
        System.out.println(cards1.size());//4.调用集合的size()方法获取元素个数

        int[]   cards2=new int[3];
        cards2[0]=1;
        cards2[1]=2;
        System.out.println(cards2[0]);
        System.out.println(cards2.length);

    }
}
